import server from '@/utils/http';
import { PaginationQuery } from '@/types/table';

enum Api {
    AppsTemplate = '/api/deviceApps/template',
    AppsActivation = '/api/deviceApps/activation',
    AppsInfo = '/api/deviceApps/info',
    AppPreviewBindingImage = '/api/deviceApps/previewBindingImage',
    Appuntie = '/api/deviceApps/untie',
}

/**
 * @description 设备流通记录
 * @param

 * @return { content: 列表, totalElements： 总数 }
 */
export const getAppsTemplate = (query: PaginationQuery): Promise<TableResponse> => {
    return server.Get(Api.AppsTemplate + `/${query.deviceCode}`);
};

/**
 * @description 设备绑定激活
 */
export const postAppsActivation = (params: NormalObj): Promise<void> => {
    return server.Post(Api.AppsActivation, params);
};

/**
 * @description 查询设备绑定信息
 * @param

 * @return { content: 列表, totalElements： 总数 }
 */
export const getAppsInfo = (query: PaginationQuery): Promise<void> => {
    return server.Get(Api.AppsInfo + `/${query.deviceCode}`);
};

/**
 * @description 价签绑定预览图
 * @param

 * @return { content: 列表, totalElements： 总数 }
 */
export const AppPreviewBindingImage = (query: any): Promise<void> => {
    return server.Post(Api.AppPreviewBindingImage, query);
};

/**
 * @description 解绑
 * @param

 * @return { content: 列表, totalElements： 总数 }
 */
export const putAppuntie = (query: PaginationQuery): Promise<void> => {
    return server.Put(Api.Appuntie + `/${query.deviceCode}`);
};
